package com.aaa.power.controller;

import com.aaa.common.util.Result;
import com.aaa.power.entity.OperLog;
import com.aaa.power.service.OperLogService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 操作日志记录(OperLog)表控制层
 *
 * @author makejava
 * @since 2020-11-12 13:59:43
 */
@RestController
@RequestMapping("operLog")
public class OperLogController {
    /**
     * 服务对象
     */
    @Resource
    private OperLogService operLogService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public OperLog selectOne(Integer id) {
        return this.operLogService.queryById(id);
    }
    /**
     * 通过年份查询操作
     * @param year
     * @return
     */
    @GetMapping("queryOpsByYear")
    public Result queryOpsByYear(Integer year){
        return this.operLogService.queryOpsByYear(year);
    }

    @GetMapping("selectYear")
    public List<Map> selectAllYear(){

        return operLogService.selectAllYear();
        /*List<Integer> list1 = new ArrayList();
        List<Map> list = operLogService.selectAllYear();
        for(Map map : list){
            Integer yy = (Integer)map.get("yy");
            list1.add(yy);
        }
        return list1;*/
    }

}